class Dictionary {
  constructor () {
    this.dataStore = []
  }

  add (key, value) {
    this.dataStore[key] = value
  }

  find (key) {
    return this.dataStore[key]
  }

  remove (key) {
    delete this.dataStore[key]
  }

  showAll () {
    for (var key of Object.keys(this.dataStore).sort()) {
      console.log(key + ' ==> ' + this.dataStore[key])
    }
  }

  count () {
    let count = 0
    for (var key in Object.keys(this.dataStore)) {
      ++count
    }
    return count
  }

  clear () {
    for (var key of Object.keys(this.dataStore)) {
      delete this.dataStore[key]
    }
  }
}

function print (ele) {
  console.log(ele)
}

var pbook = new Dictionary();
pbook.add("Raymond","123");
pbook.add("David", "345");
pbook.add("Cynthia", "456");
pbook.add("Mike", "723");
pbook.add("Jennifer", "987");
pbook.add("Danny", "012");
pbook.add("Jonathan", "666");
pbook.showAll();
